package com.gitee.wsl.common.ui.symbol.particle

import androidx.compose.ui.graphics.Color
import com.gitee.wsl.common.ui.symbol.Symbol
import kotlin.math.floor
import kotlin.random.Random

open class Particle(var startX: Float = 0f,
                    var startY: Float = 0f,
                    var size: Float = 5f,
                    var color: Color = Color.Red,
                    var alpha: Float = 1f
    ):Symbol{
    companion object{
        fun getRandomRange(min: Float, max: Float): Float {
            return (min + floor(Random.nextFloat() * (max - min + 1)))
        }
    }
}

fun <T:Particle> T.update(block:T.()->Unit){
    block(this)
}